package com.weijian.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 上传任务实体类
 * 用于记录分片上传任务信息
 */
@Data
@TableName("upload_task")
@Schema(description = "分片上传任务实体")
public class UploadTask {
    
    @TableId(type = IdType.AUTO)
    @Schema(description = "任务记录ID", example = "1")
    private Long id;
    
    /**
     * 任务ID（客户端生成）
     */
    @Schema(description = "任务ID", example = "uuid-task-123", requiredMode = Schema.RequiredMode.REQUIRED)
    private String taskId;
    
    /**
     * 文件名
     */
    @Schema(description = "文件名", example = "video.mp4", requiredMode = Schema.RequiredMode.REQUIRED)
    private String fileName;
    
    /**
     * 文件总大小（字节）
     */
    @Schema(description = "文件总大小（字节）", example = "10485760")
    private Long fileSize;
    
    /**
     * 文件MD5值
     */
    @Schema(description = "文件MD5值", example = "a1b2c3d4e5f6...")
    private String fileMd5;
    
    /**
     * 分片大小（字节）
     */
    @Schema(description = "分片大小（字节）", example = "5242880")
    private Long chunkSize;
    
    /**
     * 总分片数
     */
    @Schema(description = "总分片数", example = "2")
    private Integer totalChunks;
    
    /**
     * 已上传分片数
     */
    @Schema(description = "已上传分片数", example = "1")
    private Integer uploadedChunks;
    
    /**
     * 上传状态：0-初始化，1-上传中，2-完成，3-失败
     */
    @Schema(description = "上传状态", example = "0", allowableValues = {"0", "1", "2", "3"})
    private Integer status;
    
    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private LocalDateTime createTime;
    
    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;
}